/***************************************************************
Outline: 

0. Create workspace
1. Clean data
2. Generate main output
3. Generate appendix output

***************************************************************/

***************************************************************
*0. Create workspace
***************************************************************
clear all
set more off
cap log close

/*Set directory */


gl path   "/Users/lukas/Dropbox/Voice and Political Engagement/Submissions/Restat/Final Submission/Replication" // <-- Change this to run the code.


global scripts "$path/scripts"
global data "$path/data"
global ado "$path/scripts/ado"
global output "$path/output"




*** Set other macros ***

set scheme lean2

adopath  ++ "$ado"

*** Start log-file ***

log using "$path/master_log", replace


*** Define controls ***

global control voice_prior_high female age party_member member_years d_experience_campaign z_votes_own z_votes_other_1 z_votes_other_2  pre_doortodoor pre_days_doortodoor pre_posters pre_booth pre_online pre_call pre_friends pre_others 


***************************************************************
*1. Cleaning data
***************************************************************

do "$scripts/cleaning/1_clean_survey_data.do"

do "$scripts/cleaning/2_clean_doors_data.do"

do "$scripts/cleaning/3_clean_vignette.do"

***************************************************************
*2. Main output
***************************************************************


do "$scripts/figures/Figure_2_voice_nint_scatter.do"

do "$scripts/tables/Table_1_treat_doors_pooled_3panel.do"


***************************************************************
*3. Appendix output
***************************************************************

*Tables*
do "$scripts/tables/Table_A1_sumarystats.do"
do "$scripts/tables/Table_A2_balance_pooled.do"
do "$scripts/tables/Table_A3_balance_instrumental.do"
do "$scripts/tables/Table_A4_balance_feedback.do"
do "$scripts/tables/Table_A5_corr_doors_int.do"
* Table A6 was manually created
do "$scripts/tables/Table_A7_treat_logit.do"
do "$scripts/tables/Table_A8_treat_doors_pooled_3panel_nocont.do"
do "$scripts/tables/Table_A9_treat_intentions_pooled_3panel.do"
do "$scripts/tables/Table_A10_corr_doors_int_bytreat.do"
do "$scripts/tables/Table_A11_treat_fs_pooled_3panel.do"
do "$scripts/tables/Table_A12_treat_effective_pooled_3panel.do"
do "$scripts/tables/Table_A13_balance.do"
do "$scripts/tables/Table_A14_treat_doors_detail.do"
do "$scripts/tables/Table_A15_treat_intentions_detailed.do"
do "$scripts/tables/Table_A16_treat_fs_detail.do"
do "$scripts/tables/Table_A17_treat_length_2panel.do"
do "$scripts/tables/Table_A18_treat_length_2panel_nocont.do"

*Figures*
do "$scripts/figures/Figure_A1_voice_dist.do"
do "$scripts/figures/Figure_A2_voice_corr.do"
do "$scripts/figures/Figure_A3_voice_nint_scatter.do"


* Vignette data *
do "$scripts/figures/Figure_A4_vignette_CDFs.do"
do "$scripts/tables/Table_A19_sum_vignette.do"
do "$scripts/tables/Table_A20_vignette_regression.do"



log close


